﻿using ExcelUnity.Core;
using ExcelUnity.Exporter.Exporters;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.IO;

namespace ExcelUnity.Exporter
{
    public interface IExcelExporter
    {
        /// <summary>
        /// 导出到文件
        /// </summary>
        /// <param name="book"></param>
        /// <param name="filePath"></param>
        void Export(ExportBook book, string filePath);

        /// <summary>
        /// 导出到文件流
        /// </summary>
        /// <param name="book"></param>
        /// <param name="stream"></param>
        void Export(ExportBook book, Stream stream);

        /// <summary>
        /// 导出返回字节数组
        /// </summary>
        /// <param name="book"></param>
        /// <returns></returns>
        byte[] Export(ExportBook book);

        /// <summary>
        /// 根据类型创建excel返回字节数组(自定义工作簿)
        /// </summary>
        /// <param name="fileType">文件类型</param>
        /// <param name="workBookAction">IWorkbook</param>
        byte[] Export(FileType fileType, Action<IWorkbook> workBookAction);

        /// <summary>
        /// 根据类型创建excel返回文件流（自定义工作簿）
        /// </summary>
        /// <param name="fileType">文件类型</param>
        /// <param name="workBookAction">IWorkbook</param>
        void Export(FileType fileType, Stream stream, Action<IWorkbook> workBookAction);

        /// <summary>
        ///创建sheet，并且赋值自定义内容
        /// </summary>
        /// <param name="workBook"></param>
        /// <param name="sheetConfigDto"></param>
        /// <param name="sheetCellList"></param>
        /// <param name="columnWidths"></param>
        void CreateCustomerContnetToSheet(IWorkbook workBook, ExportSheetConfig sheetConfigDto, IEnumerable<ExportCustomerSheetCell> sheetCellList,
    List<(int columnIndex, int? minWidth, int? maxWidth)>? columnWidths = null);

        /// <summary>
        ///在指定sheet追加自定义内容
        /// </summary>
        /// <param name="workBook"></param>
        /// <param name="sheetCellList"></param>
        /// <param name="columnWidths"></param>
        void AppendCustomerContentToSheet(IWorkbook workBook, ISheet sheet, IEnumerable<ExportCustomerSheetCell> sheetCellList,
           List<(int columnIndex, int? minWidth, int? maxWidth)>? columnWidths = null);

        /// <summary>
        /// 创建工作簿(标题-表格-自定义内容)
        /// </summary>
        /// <param name="workBook"></param>
        /// <param name="exportBookSheet"></param>
        /// <param name="sheetInfo"></param>
        void CreateTitleAndTableAndCustomerSheet(IWorkbook workBook, ExportSheet exportBookSheet, Action<ISheet, int> sheetInfo);

        /// <summary>
        /// 创建工作簿(标题-表格)
        /// </summary>
        /// <param name="workBook"></param>
        /// <param name="exportBookSheet"></param>
        void CreateTitleAndTableSheet(IWorkbook workBook, ExportSheet exportBookSheet);
    }
}